from api5 import *

#列出课程
coureListBefore = list_course()['retlist']

#添加一门课程
addret= add_course('c++','c++课程','2')
assert addret['retcode'] == 0
print('添加课程成功')

#列出课程
coureListafter = list_course()['retlist']

#在添加一门课程
addret= add_course('c++','c++课程',2)
assert addret['retcode'] == 2
print('添加同名课程 已经存在')

newcourse = None
for one in coureListafter:
    if one not in coureListBefore:
        newcourse = one

# assert newcourse['display_idx']== 2


# 清除环境操作
delete_course(newcourse['id'])

print('\n========= test case pass =============')
